﻿<?php
session_start();
if(isset($_SESSION['userNum'])&& $_SESSION['voter_permission'] == 'Admin'){
$userNum = $_SESSION['userNum'];
}else{
header('Location: home.php');
}
?>
<html>
<head>
<title>Candidates - APC Voting System</title>
<style type="text/css">
.style1 {
	border-collapse: collapse;
}
.style2 {
	border-collapse: collapse;
	background-image: url('images/bg.png');
}
</style>
</head>

<body>
<font face = "Arial">
<table style="width: 810px; height: 104px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="height: 10px" width="10px">
&nbsp;</td>
<td style="height: 10px">
&nbsp;</td>
</tr>
<tr>
<td colspan="2" style="height: 104px">
<img src="images\header.png"></td>
</tr>
</table>

<table style="width: 810px" background="images\menu.png" cellspacing="0" cellpadding="0">
<tr >
<td style="width: 11px; height: 40px">
&nbsp;</td>
<td style="width: 84px; height: 40px">
<a href="home.php"><img src="images\homeS.png"></a></td>
<td style="width: 84px; height: 40px">
<a href="vote.php"><img src="images\voteS.png"></a></td>
<td style="width: 84px; height: 40px">
<a href="candidates.php"><img src="images\candidateS.png"></a></td>
<td style="width: 84px; height: 40px">
<?php
mysql_connect("localhost", "root@localhost", "") or die(mysql_error());
mysql_select_db("apc_vote") or die(mysql_error());
$checkPermission = mysql_query("SELECT voter_permission from voters where voter_num = '".$userNum."'");
while($row = mysql_fetch_array($checkPermission)){
$permission = $row['voter_permission'];
}
if($permission == 'Admin'){
echo "<a href='admin.php'><img src='images\adminS.png'></a>";
}elseif($permission == 'Voter'){
echo "<a href='results.php'><img src='images/resultS.png'></a>";
}else{
}
?>
</td>
<td style="width: 447px; height: 40px">
</td>
<td style="width: 84px; height: 40px">
<a href="logout.php"><img src="images\logoutS.png"></a></td>
</tr>
</table>
<table style="width: 810px; height: 73px" cellspacing="0" cellpadding="0" class="style2">
<tr>
<td style="height: 76px; width: 28px;"></td>
<td style="height: 76px" width="808px">
<br><br>
<table style="width: 590px" border="0" cellspacing="0" cellpadding="0">
<form method="post" action="control.php">
<tr>
<td colspan="3">
<h3>Administrative Functions</h3></td>
</tr>
<tr>
<td style="width: 231px">

<input type='submit' value='Show Results' name='voteAction' style='width: 111px'></td>
<td style="width: 13px">
&nbsp;</td>
<td style="width: 318px">
Shows results in window</td>
</tr>
<tr style='background-color:silver'>
<td style="width: 231px">
&nbsp;<input type='submit' value='End Voting' name='voteAction' style='width: 111px'><font face = "Arial">&nbsp;
</font><label id="Label1">asdasddsa</label><input align="middle" name="Submit1" type="submit" value="submit" style="width: 31px" /></td>
<td style="width: 13px">

&nbsp;</td>
<td  style="width: 318px">

Ends the voting then  shows results to all voters</td>
</tr>
</form>
</table>




</td>
</tr>
<tr>
<td width="8px" colspan="2"><img src="images\end.png"></td>


</tr>
</table>

</body>

</html>
